<template>
	<view class="wrapper">
		<view class="Pusher_btn center flex-end">
			<image src="../../static/chatFriend/closePush.png" mode="aspectFit" class="closePush"></image>
			<image src="../../static/chatFriend/switch.png" mode="aspectFit" class="switch"></image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				messageId:''
			};
		},
		onLoad(e) {
			this.messageId=e.messageId
			this.pusher()
		},
		methods:{
			pusher(){
				// 推流
				const res = uni.getSystemInfoSync().windowHeight;
				let pusher = plus.video.createLivePusher('livepusher', {
					url: 'rtmp://app.xs1s.com:1935/hls/2',
					mode: 'FHD',
					beauty: 1,
					whiteness: 5,
					aspect: '9:16',
					top: 0,
					height: (uni.getSystemInfoSync().windowHeight - 50) +'px',
					position: 'absolute'
				});
				pusher.switchCamera();
				pusher.start();
				plus.webview.currentWebview().append(pusher);
				// 拉流
				let player = plus.video.createVideoPlayer('videoplayer', {
					src: 'rtmp://app.xs1s.com:1935/hls/2',
					top: 0,
					autoplay:true,
					controls:false,
					'show-fullscreen-btn':false,
					'show-progress':false,
					'show-play-btn':false,
					'show-center-play-btn':false,
					height: '200px',
					left:'65%',
					width:'35%',
					position: 'absolute',
					objectFit:'fill'
				});
				plus.webview.currentWebview().append(player);
			}
		}
	}
</script>

<style lang="scss">
.Pusher_btn{
	position: fixed;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 50px;
	background: rgba(0,0,0,.8);
	color: #FFFFFF;
	z-index: 999;
	padding: 0 80rpx;
	image{
		height: 60rpx;
	}
	.closePush{
		width: 200rpx;
		margin-right: 130rpx;
	}
	.switch{
		width: 60rpx;
	}
}
</style>
